package com.example.activity;

import android.app.Activity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.TextView;
import java.util.ArrayList;

import com.example.smart_home.R;
import com.example.util.CommandCommunicate;
import com.example.util.ShowHandle;

public class MediaTvBoxActivity extends Activity {
	MediaTvBoxActivity context;
	ArrayList<String[]> data;
	String deviceId;
	 private CommandCommunicate mCommandCommunicate;
	ShowHandle showHandle;
	private ImageButton btnOpen,btnColse,btnUp,btnDown,btnLeft,btnRight,btnReturn;

	public void onCreate(Bundle paramBundle) {
		super.onCreate(paramBundle);
		setContentView(R.layout.media_jidinghe);
		this.context = this;
		this.showHandle = new ShowHandle(this, "it");
		this.deviceId = getIntent().getStringExtra("deviceId");
		this.showHandle.OpenDb();
		this.data = this.showHandle.getDeviceKey(this.deviceId);
		this.showHandle.CloseDb();
		this.mCommandCommunicate = new CommandCommunicate(this);
		((TextView) findViewById(R.id.title)).setText(getResources().getString(
				R.string.jidinghe));
		((TextView) findViewById(R.id.tvHomeName)).setText(getIntent()
				.getStringExtra("roomName"));
		findViewById(R.id.btnBack).setOnClickListener(new View.OnClickListener() {
			public void onClick(View paramAnonymousView) {
				//MyAudioManager.spPlaySound(0, false);
				MediaTvBoxActivity.this.finish();
			}
		});
		findViewById(R.id.btnOpen).setOnClickListener(new View.OnClickListener() {
			public void onClick(View paramAnonymousView) {
				MediaTvBoxActivity.this.mCommandCommunicate
						.send(((String[]) MediaTvBoxActivity.this.data.get(0))[3]);
			}
		});
		findViewById(R.id.btnClose).setOnClickListener(new View.OnClickListener() {
			public void onClick(View paramAnonymousView) {
				MediaTvBoxActivity.this.mCommandCommunicate
						.send(((String[]) MediaTvBoxActivity.this.data.get(1))[3]);
			}
		});
		findViewById(R.id.btn3).setOnClickListener(new View.OnClickListener() {
			public void onClick(View paramAnonymousView) {
				MediaTvBoxActivity.this.mCommandCommunicate
						.send(((String[]) MediaTvBoxActivity.this.data.get(2))[3]);
			}
		});
		findViewById(R.id.btn6).setOnClickListener(new View.OnClickListener() {
			public void onClick(View paramAnonymousView) {
				MediaTvBoxActivity.this.mCommandCommunicate
						.send(((String[]) MediaTvBoxActivity.this.data.get(5))[3]);
			}
		});
		findViewById(R.id.btn7).setOnClickListener(new View.OnClickListener() {
			public void onClick(View paramAnonymousView) {
				MediaTvBoxActivity.this.mCommandCommunicate
						.send(((String[]) MediaTvBoxActivity.this.data.get(6))[3]);
			}
		});
		findViewById(R.id.btn8).setOnClickListener(new View.OnClickListener() {
			public void onClick(View paramAnonymousView) {
				MediaTvBoxActivity.this.mCommandCommunicate
						.send(((String[]) MediaTvBoxActivity.this.data.get(7))[3]);
			}
		});
		findViewById(R.id.btn9).setOnClickListener(new View.OnClickListener() {
			public void onClick(View paramAnonymousView) {
				MediaTvBoxActivity.this.mCommandCommunicate
						.send(((String[]) MediaTvBoxActivity.this.data.get(8))[3]);
			}
		});
		findViewById(R.id.btn10).setOnClickListener(new View.OnClickListener() {
			public void onClick(View paramAnonymousView) {
				MediaTvBoxActivity.this.mCommandCommunicate
						.send(((String[]) MediaTvBoxActivity.this.data.get(9))[3]);
			}
		});
		findViewById(R.id.btn11).setOnClickListener(new View.OnClickListener() {
			public void onClick(View paramAnonymousView) {
				MediaTvBoxActivity.this.mCommandCommunicate
						.send(((String[]) MediaTvBoxActivity.this.data.get(10))[3]);
			}
		});
		findViewById(R.id.btn12).setOnClickListener(new View.OnClickListener() {
			public void onClick(View paramAnonymousView) {
				MediaTvBoxActivity.this.mCommandCommunicate
						.send(((String[]) MediaTvBoxActivity.this.data.get(11))[3]);
			}
		});
		findViewById(R.id.btn13).setOnClickListener(new View.OnClickListener() {
			public void onClick(View paramAnonymousView) {
				MediaTvBoxActivity.this.mCommandCommunicate
						.send(((String[]) MediaTvBoxActivity.this.data.get(12))[3]);
			}
		});
		findViewById(R.id.btn14).setOnClickListener(new View.OnClickListener() {
			public void onClick(View paramAnonymousView) {
				MediaTvBoxActivity.this.mCommandCommunicate
						.send(((String[]) MediaTvBoxActivity.this.data.get(13))[3]);
			}
		});
		findViewById(R.id.btn15).setOnClickListener(new View.OnClickListener() {
			public void onClick(View paramAnonymousView) {
				MediaTvBoxActivity.this.mCommandCommunicate
						.send(((String[]) MediaTvBoxActivity.this.data.get(14))[3]);
			}
		});
		findViewById(R.id.btn16).setOnClickListener(new View.OnClickListener() {
			public void onClick(View paramAnonymousView) {
				MediaTvBoxActivity.this.mCommandCommunicate
						.send(((String[]) MediaTvBoxActivity.this.data.get(15))[3]);
			}
		});
		findViewById(R.id.btn17).setOnClickListener(new View.OnClickListener() {
			public void onClick(View paramAnonymousView) {
				MediaTvBoxActivity.this.mCommandCommunicate
						.send(((String[]) MediaTvBoxActivity.this.data.get(16))[3]);
			}
		});
		findViewById(R.id.btn5).setOnClickListener(new View.OnClickListener() {
			public void onClick(View paramAnonymousView) {
				MediaTvBoxActivity.this.mCommandCommunicate
						.send(((String[]) MediaTvBoxActivity.this.data.get(4))[3]);
			}
		});
	}
}